package week1;

import java.util.Scanner;

public class T6 {
    public static void main(String[] args) {
        //creat
        System.out.print("g=");
        Scanner scanner=new Scanner(System.in);
        String input=scanner.nextLine();
        String input1=input.substring(1,input.length()-1);
        String[] elements=input1.split(",");
        int[] g=new int[elements.length];
        for (int i=0;i<elements.length;i++){
            g[i]=Integer.parseInt(elements[i]);
        }

        System.out.print("s=");
        Scanner scanner1=new Scanner(System.in);
        String input2=scanner1.nextLine();
        String input3=input2.substring(1,input.length()-1);
        String[] elements1=input3.split(",");
        int[] s=new int[elements1.length];
        for (int i=0;i<elements1.length;i++){
            s[i]=Integer.parseInt(elements1[i]);
        }

        //sort
        int emp=0;
        for (int i=0;i< g.length;i++)
        {
            for (int j=0;j<g.length-1-i;j++){
                if(g[j]>g[j+1]){
                    emp=g[j];
                    g[j]=g[j+1];
                    g[j+1]=emp;
                }
            }
        }
        for (int i=0;i< s.length;i++)
        {
            for (int j=0;j<s.length-1-i;j++){
                if(s[j]>s[j+1]){
                    emp=s[j];
                    s[j]=s[j+1];
                    s[j+1]=emp;
                }
            }
        }


        //find
        int cnt=0;
        for (int i=0;i< g.length;i++) {
            for (int j=0;j<s.length;j++){
                if (s[j]>=g[i]){
                    cnt++;
                    s[j]=0;
                    break;
                }
            }
        }


        System.out.println(cnt);

    }
}